package com.gexiaobao.pigeon.ui.adapter

import androidx.appcompat.widget.AppCompatImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.ImageListBean
import com.gexiaobao.pigeon.app.util.ImageLoaderManager
import com.gexiaobao.pigeon.app.util.PictureUtil
import com.gexiaobao.pigeon.databinding.ItemBloodPigeonPictureBinding

/**
 * @Author      : hxw
 * @Date        : 2024/8/26 16:131
 * @Describe    :
 */
class AdapterBloodPigeonPicture(data: ArrayList<ImageListBean>) :
    BaseQuickAdapter<ImageListBean, DataBindBaseViewHolder>(R.layout.item_blood_pigeon_picture, data) {
    override fun convert(holder: DataBindBaseViewHolder, item: ImageListBean) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemBloodPigeonPictureBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        val ivItemBloodPigeonPic = holder.getView<AppCompatImageView>(R.id.ivItemBloodPigeonPic)
        ImageLoaderManager.loadRoundImage(context, item.url, ivItemBloodPigeonPic, 14)

        PictureUtil.printImageInfoFromUrl(item.url)
    }
}